<template>
	<view class="worktop">
		<view class="worktopmian" v-if="show" @click="swTeam">
			<view class="worktopl">
				{{teamName ? teamName  : ''  }}
			</view>
			<view class="worktopr"  >
				<view class="">
					<u-icon name="arrow-right" color="#212121;" size="36rpx"></u-icon>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		checkTeamUserOnTeam
	} from '@/api/index.js'
	export default {
		props: {
			teamName: {
				default: '',
				required: false
			},
			singleTean: {
				default: false,
				required: false
			},
		},
		data() {
			return {
				show: true,
				qie:require('@/static/img/qie.png') 
				//teamName:''
			}
		},
		 mounted() {
			//console.log(res.data,121212);
			// let res = uni.getStorageSync('myTeam')
			// if (res && res?.code == 200) {
			// 	this.teamName = res.data.name
			// 	this.isInTeam(res.data.id)
			// }
		},
		methods: {
			async isInTeam(teamId) {
				let res = await checkTeamUserOnTeam(teamId)
				//console.log(res.data,121212);
				if (!res.data) { //不在团队里把缓存清掉
					this.show = false
					uni.removeStorageSync('myTeam')
				}
				//console.log(userId,111);
			},
			swTeam() {
				if (this.singleTean) return
				uni.navigateTo({
					url: '/pages/wenjuan/switchTeam'
				})
			}
		},
	}
</script>

<style lang="scss" scoped>
	.inactive {
		background-color: #A6DFEC !important;
	}

	.worktop {
		//margin-top: 20rpx;
		width: 100%;
		//height: 108rpx;
		background: #FFFFFF;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		padding: 10px 10px 0 10px;

		.worktopmian {
			width: 100%;
			margin: 0 auto;
			display: flex;
			justify-content: space-between;
			align-items: center;
			overflow: hidden;

			.worktopl {
				font-weight: 500;
				font-size: 32rpx;
				color: #212121;
				//line-height: 108rpx;
			}

			.worktopr {
				display: flex;
				align-items: center;
				// width: 200rpx;
				// height: 60rpx;
				//background: #4DC0D9;
				border-radius: 12rpx 12rpx 12rpx 12rpx;
				//margin-top: 24rpx;

				.qielogo {
					width: 32rpx;
					height: 32rpx;
					margin-top: 14rpx;
					margin-left: 20rpx;

					image {
						width: 100%;
						height: 100%;
					}
				}

				.qietit {
					font-weight: 500;
					margin-left: 20rpx;
					font-size: 30rpx;
					color: #FFFFFF;
					line-height: 60rpx;
				}
			}
		}
	}
</style>